package map;

public class L383 {
    public boolean canConstruct(String ransomNote, String magazine) {
        char[] record = new char[26];
        for (int i=0;i<ransomNote.length();i++){
            char c = ransomNote.charAt(i);
            int index=c-'a';
            record[index]+=1;
        }
        for (int j=0;j<magazine.length();j++){
            char c = magazine.charAt(j);
            if (record[c-'a']==0){
                continue;
            }else {
                record[c-'a']-=1;
            }
        }
        for (Character c:record){
            if (c !=0){
                return false;
            }
        }
        return true;

    }
}
